package jass.iss.edu.Properties;



import java.io.IOException;
import java.util.Properties;



public class CompanyDAO extends PropertiesDAO<CompanyDTO> {



	public CompanyDAO() throws IOException {
		super("company.properties");

	}
	

	@Override
	protected CompanyDTO read(Properties pProp, String pID) {
		CompanyDTO company = new CompanyDTO(pID);			
		company.setCompanyName(pProp.getProperty("CompanyName"+pID));
		company.setCompanyAddress(pProp.getProperty("CompanyAddress"+pID));
		company.setRegistrationNo(pProp.getProperty("RegistrationNo"+pID));
		company.setIndustry(pProp.getProperty("Industry"+pID));
		company.setDescription(pProp.getProperty("Description"+pID));
		company.setWebsite(pProp.getProperty("Website"+pID));
		company.setEmail(pProp.getProperty("Email"+pID));
		company.setContact(pProp.getProperty("Contact"+pID));
		
		return company;
	}


	@Override
	protected void write(Properties prop, CompanyDTO dto) {
		String strID = dto.getId();
		prop.setProperty( "CompanyName"+strID,  dto.getCompanyName());
		prop.setProperty( "CompanyAddress"+strID,  dto.getCompanyName());
		prop.setProperty( "RegistrationNo"+strID,  dto.getCompanyName());
		prop.setProperty( "Industry"+strID,  dto.getCompanyName());
		prop.setProperty( "Description"+strID,  dto.getCompanyName());
		prop.setProperty( "Website"+strID,  dto.getCompanyName());
		prop.setProperty( "Email"+strID,  dto.getCompanyName());
		prop.setProperty( "Contact"+strID,  dto.getCompanyName());


	}



}
